Extracting File Information from the INF file

After the INF file is opened, you can gather information from it to build the user interface, or to direct the installation process. The setup functions provide several levels of functionality for gathering information from an INF file.

To gather information 

Use these functions 

About the INF file

SetupGetInfInformationLCA0LF

 

SetupQueryInfFileInformationI3Y7PI

 

SetupQueryInfVersionInformation3XC8_A5.

 

 

About source and target files

SetupGetSourceFileLocationC7M3CE

 

SetupGetSourceFileSize.OFDGZ

 

SetupGetTargetPathW.OJRD

 

SetupGetSourceInfo1OI5_ZX

 

 

From a line of an INF file

SetupGetLineText3WY0_H_

 

SetupFindNextLine14DANTT

 

SetupFindNextMatchLine2KZNIC

 

SetupGetLineByIndex3P02514

 

SetupFindFirstLine5ODYOE

 

 

From a field of a line in an INF file

SetupGetStringField3VBJSM

 

SetupGetIntField1MIVAHG,

 

SetupGetBinaryField1216G_A

 

SetupGetMultiSzField1G2N7S4

 

The following example uses the SetupGetSourceInfo function to retrieve the human-readable description of a source media from an INF file.

test = SetupGetSourceInfo (

     MyInf,                   \\Handle to the INF file to access

     SourceId,                \\Id of the source media

     SRCINFO_DESCRIPTION,     \\which information to retrieve

     Buffer,                  \\a pointer to the buffer to

                              \\  receive the information

     MaxBufSize,              \\the size allocated for the buffer

     &BufSize                 \\buffer size actually needed

);

 

In the example, MyInf is the handle to the open INF file. SourceId is the identifier for a specific source media. The value SRCINFO_DESCRIPTION specifies that the SetupGetSourceInfo function should retrieve the source media description. Buffer points to a string that will receive the description, MaxBufSize indicates the resources allocated to the buffer, and BufSize indicates the resources necessary to store the buffer.

If BufSize is greater than MaxBufSize, the function will return FALSE, and a subsequent call to GetLastError11C2VS7 will return ERROR_INSUFFICIENT_BUFFER.